package com.iworkh.spring.ioc;

import com.iworkh.spring.ioc.bean.entity.Dog;
import com.iworkh.spring.ioc.bean.entity.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 使用spring框架
 *
 * @author: iworkh-沐雨云楼
 * @date: 2019-12-16
 */
public class App {

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
        Student student = (Student)context.getBean("student");

        System.out.println("spring--"+student.getName());

        Dog dog_feizai = (Dog)context.getBean("dog_feizai");
        System.out.println("构造--"+dog_feizai);

        Dog dog_huahua = (Dog)context.getBean("dog_huahua");
        System.out.println("构造--"+dog_huahua);

        Dog dog_doudou = (Dog)context.getBean("dog_doudou");
        System.out.println("构造--"+dog_doudou);


        Student student_zs = (Student)context.getBean("student_zs");
        System.out.println(student_zs);

        Student student_ww = (Student)context.getBean("student_ww");
        System.out.println(student_ww);

        Student student_ls = (Student)context.getBean("student_ls");
        System.out.println(student_ls);

        Student student_xiaoqing = (Student)context.getBean("student_xiaoqing");
        System.out.println(student_xiaoqing);

        Student student_ledi = (Student)context.getBean("student_ledi");
        System.out.println(student_ledi);

        Student student_xiaoming = (Student)context.getBean("student_xiaoming");
        System.out.println(student_xiaoming);

        Student student_guangtouqiang = (Student)context.getBean("student_guangtouqiang");
        System.out.println(student_guangtouqiang);

        Student student_daming = (Student)context.getBean("student_daming");
        System.out.println(student_daming);

        Student student_xiaoyan_p = (Student)context.getBean("student_xiaoyan_p");
        System.out.println(student_xiaoyan_p);

        Dog dog_nana_c = (Dog)context.getBean("dog_nana_c");
        System.out.println(dog_nana_c);

        Student student_lindong = (Student)context.getBean("student_lindong");
        System.out.println(student_lindong);
    }
}
